package com.iweb.work;

public class Student {
    private String name;
    private String sex;
    private int age;
    private String dire;


    public void setName(String name) {
        if (name.length() <= 4) {
            this.name = name;
        } else {
            System.out.println("xxx");
        }
    }

    public String getName() {
        return name;
    }

    public void setSex(String sex) {
        if (sex == "男" || sex == "女") {
            this.sex = sex;
        } else {
            System.out.println("男");
        }
    }

    public String getSex() {
        return sex;
    }
    public void setAge(int age) {
        if (age > 1 && age < 60) {
            this.age = age;
        } else {
            System.out.println("25");
        }
    }
    public int getAge() {
        return age;
    }
    public void setDire(String dire) {
        if (dire == ".net" || dire == "java"){
            this.dire = dire;
    } else
    {
        System.out.println("java");
    }
}
    public String getDire() {
        return dire;
    }
    public void show(){
        System.out.println("姓名"+this.name+"性别"+this.sex+"方向"+this.dire+"年龄"+this.age);
    }
}
